#include <LPC214x.H>                       /* LPC214x definitions */

#define BUZZER (1 << 25)
#define BUZZER_DIR FIO1DIR
#define BUZZER_SET FIO1SET
#define BUZZER_CLR FIO1CLR

						  
void delay(int count);
void turn_on_buzzer(void);
void turn_off_buzzer(void);

int main (void) 
{
  SCS |= 0x02;
  FIO1MASK = ~BUZZER;

  while (1)  
  {
  	turn_on_buzzer();
   	delay(1000);
 	turn_off_buzzer();
   	delay(1000);
  }
}

void delay(int count)
{
  int j=0,i=0;

  for(j=0;j<count;j++)
  {
    /* At 60Mhz, the below loop introduces
    delay of 1000 us */
    for(i=0;i<3500;i++);
  }
}

void turn_on_buzzer(void)
{    
  BUZZER_DIR |= BUZZER;
  BUZZER_CLR = BUZZER;	
}

void turn_off_buzzer(void)
{
   BUZZER_DIR |= BUZZER;
   BUZZER_SET = BUZZER;
}
